//
//  TWscrollView.m
//  7.14详情
//
//  Created by lovena on 15/7/16.
//  Copyright (c) 2015年 lovena. All rights reserved.
//

#import "TWscrollView.h"
#import "UIImageView+WebCache.h"
@implementation TWscrollView

-(id)initWithFrame:(CGRect)frame
{
    self=[super initWithFrame:frame];
    if (self) {
        //加载图片
        //数据
        _imageArray=[NSMutableArray array];
        NSString *path=[[NSBundle mainBundle]pathForResource:@"TW.plist" ofType:nil];
        NSArray *array=[NSArray arrayWithContentsOfFile:path];
        _imageArray=array[0];
        self.delegate=self;
        self.showsHorizontalScrollIndicator=NO;
        self.bounces=NO;
        self.decelerationRate=0.5;
        
        for(int i=0;i<_imageArray.count;i++)
        {
            UIImageView *image=[[UIImageView alloc]initWithFrame:CGRectMake(0, i*self.frame.size.height, 320, self.frame.size.height)];
            [image setImageWithURL:[NSURL URLWithString:_imageArray[i]]];
            [self addSubview:image];
            
        }
        self.contentSize=CGSizeMake(0, self.frame.size.height*_imageArray.count);
    }
    return self;
}

@end
